package cn.itsource.controller;

import cn.itsource.dto.SmsDto;
import cn.itsource.result.JSONResult;
import cn.itsource.service.IVerifycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * 验证码相关
 * @Author: Jason
 * @Date: 2022/9/7 17:12
 */
@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    private IVerifycodeService iVerifycodeService;

    //发送短信验证码
    @PostMapping("/sendSmsCode")
    public JSONResult sendSmsCode(@RequestBody SmsDto dto){
        return iVerifycodeService.sendSmsCode(dto);
    }

    //获取图片验证码数据
    @GetMapping("/imageCode/{uuid}")
    public JSONResult imageCode(@PathVariable("uuid") String uuid){
        return iVerifycodeService.imageCode(uuid);
    }
}
